package com.yuanrui.yrclub.oss.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AliConfig {
    @Value("${aliyun.oss.access-key}")
    private String ACCESS_KEY_ID;

    @Value("${aliyun.oss.secret-key}")
    private String ACCESS_KEY_SECRET;

    @Value("${aliyun.oss.bucket-name}")
    private String bucketName;

    @Value("${aliyun.oss.endpoint}")
    private String endpoint;

    @Bean
    public OSS getOssClient() {
        return new OSSClientBuilder().build(endpoint, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
    }
}
